package com.xielx.httpclikent.bean;

import com.alibaba.fastjson.JSON;

import java.io.Serializable;

public class MyHttpPost extends MyHttpRequest implements Serializable {
    private static final long serialVersionUID = 4805343353103661771L;
    private byte[] data;

    public MyHttpPost(String url, byte[] data) {
        super(url);
        this.data = data;
    }

    public MyHttpPost(String url) {
        super(url);
    }

    @Override
    public boolean isPost() {
        return true;
    }

    @Override
    public String getMethod() {
        return "POST";
    }

    public byte[] getData() {
        return data;
    }

    public void setData(byte[] data) {
        this.data = data;
    }

    public void setData(Object data) {
        this.data = JSON.toJSONBytes(data);
    }
}
